rate = 0.03 # 全局变量rate
def taxCaculator(tax_income):
    if tax_income < 3000:
        rate = 0.03 # 局部变量
    else:
        rate = 0.1 # 局部变量
    tax = tax_income * rate
    print('利用税率{:.2%} 计算的应纳税额为: {:.2f}元'.format(rate, tax))
taxCaculator(20000)
print('调用函数后的遂率是: {:.2%}'.format(rate))